# -*- coding: utf-8 -*-

from flask import abort
from dicthash.decorators import html_it, json_it
from dicthash.utils import project2dict

from .backends.working.models import User


UserProperties = ['name', 'openid']

def _proj(user):
    """ """
    return project2dict(user, UserProperties)


def _view_user_data(username):
    """ """
    return dict(user_in_question=_proj(User.get_by_name(username)) or abort(404))


view_user_data = html_it ('user/view_user_data.html') (_view_user_data)
view_user_data_json = json_it () (_view_user_data)